﻿@{
    ViewBag.Title = "网页模板";
    Layout = "~/Views/Shared/_ListLayout.cshtml";
}
@inherits CMSWebViewPage<object>
<div id="toolbar_template" class="datagrid-toolbar">
    @CurrentButtonTool.Create()
    @*    <div class="top-tool">
        <a class="easyui-linkbutton" onclick="Add();" data-options="iconCls:'icon-add',plain:true">新增</a>
    </div>
    <div class="easyui-menu right-tool">
        <div onclick="Edit();" data-options="iconCls:'icon-edit'">编辑</div>
        <div onclick="Delete();" data-options="iconCls:'icon-remove'">删除</div>
    </div>*@
    <div>
        <form id="fr_search_template">
            @Html.QueryStringBox("TestString", "TestString")
            @Html.QueryDateTimeBox("TestDate", "TestDate")
            -
            @Html.QueryDateTimeBox("TestDate", "TestDate", QueryMethod.LessEqual, QueryDataType.DateTime)
            @Html.QueryComboBox("TesInt", "TesInt", new List<SelectListItem>
           {
                new SelectListItem{Text="测试1",Value="1"},
                new SelectListItem{Text="测试2",Value="2"},
                new SelectListItem{Text="测试3",Value="3"},
                new SelectListItem{Text="测试4",Value="4"},
           })
            @Html.QueryComboBox("TestComboBoxRemote", "TestComboBoxRemote", "/Template/TestListJson")
            <a href="javascript:void(0)" onclick="Search();" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true">Search</a>
        </form>
    </div>
</div>
<table id="dg_template" data-options="url:'/template/listjson/',border:false,fit:true,fitColumns:true,toolbar:'#toolbar_template',singleSelect:true,pagination:true,pageSize:20">
    <thead>
        <tr>
            <th data-options="field:'ck',checkbox:true"></th>
            <th data-options="field:'Id',width:80,align:'center'">Id</th>
            <th data-options="field:'TestString',width:80,align:'center'">TestString</th>
            <th data-options="field:'TestBool',formatter:BooleanToString,width:100,align:'center'">TestBool</th>
            <th data-options="field:'TesInt',formatter:TestIntFormat,width:80,align:'center'">TesInt</th>
            <th data-options="field:'TestDouble',width:80,align:'center'">TestDouble</th>
            <th data-options="field:'TestDate',formatter:JsonToDate,width:220,align:'center'">TestDate</th>
        </tr>
    </thead>
</table>
@section Bottom{
    <script type="text/javascript">
        var objBizDatagrid = new BizDatagrid('#dg_template');
        function Add() {
            objBizDatagrid.add("/template/editpage/");
        }
        function Edit() {
            objBizDatagrid.edit("/template/editpage/");
        }
        function Search() {
            objBizDatagrid.search('#fr_search_template', '/template/listjson/');
        }
        function Delete() {
            objBizDatagrid.del('/template/delete/');
        }
        function TestIntFormat(val) {
            var result = "";
            switch (val) {
                case 1:
                    result = "测试1";
                    break;
                case 2:
                    result = "测试2";
                    break;
                case 3:
                    result = "测试3";
                    break;
                case 4:
                    result = "测试4";
                    break;
            }
            return result;
        }
    </script>
}